package com.will.txj.aj.security.controller;

import com.will.txj.common.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: wen-yi;
 * @date: 2021/12/5 10:03;
 * @Description:
 */
@RestController
@Api(tags = "错误状态响应")
@RequestMapping("error")
public class ErrorController {

    @ApiOperation("状态401")
    @GetMapping("401")
    public R error401(){
        return R.fail(HttpStatus.UNAUTHORIZED);
    }

    @ApiOperation("状态403")
    @GetMapping("403")
    public R error403(){
        return R.fail(HttpStatus.FORBIDDEN);
    }

    @ApiOperation("状态404")
    @GetMapping("404")
    public R error404(){
        return R.fail(HttpStatus.NOT_FOUND);
    }

    @ApiOperation("状态415")
    @GetMapping("415")
    public R error415(){
        return R.fail(HttpStatus.UNSUPPORTED_MEDIA_TYPE);
    }

    @ApiOperation("状态500")
    @GetMapping("500")
    public R error500(){
        return R.fail(HttpStatus.INTERNAL_SERVER_ERROR);
    }
}
